import React from 'react';
import { Text, View, Modal as XModal } from 'react-native';
import styles from './styles';

const FN = () => null;

export default props => {
  return (
    <XModal
      onRequestClose={props.onRequestClose || FN}
      visible={props.visible}
      transparent={true}
    >
      <View
        style={[
          styles.wrap,
          {
            backgroundColor: props.maskStyle || 'rgba(0,0,0,0.3)'
          }
        ]}
      >
        <View style={styles.main}>
          {props.title ? <Text style={styles.title}>{props.title}</Text> : null}
          <View style={styles.cont}>{props.children}</View>
          {props.footer ? (
            <View style={styles.footer}>{props.footer}</View>
          ) : null}
        </View>
      </View>
    </XModal>
  );
};
